<?php
session_save_path('sessions');
session_start();

include("include/dbUserTypes.php");

// Include our user class
include_once("include/user.php");

// Create a variable to store our user if we're validated
$user = null;

// Check if we're in a valid session. If not, go back to main login page.

if( !isset($_SESSION['user']) || $_SESSION['user'] == null ) {
    header("location:main_login.php");
}
else {
    // Unserialize our user to turn it back into a useful object
    $user = unserialize($_SESSION['user']);
}

// If we're not a business (or admin) or registered go back to the user redirection page
if( $user->getUserType() != $USERTYPE_REGISTERED && $user->getUserType() != $USERTYPE_ADMIN&& $user->getUserType() != $USERTYPE_BUSINESS)
    header("location:login_success.php");


// Include the header (CSS files, etc)
include("include/dbconnection.php");
include("include/header.php"); ?>


<body>
  <div id="wrapper">
    <div id="header"> </div>
    <div id="left">
      <div id="logo">
        <h1>Home Sale</h1>
        <p>Only By Owner</p>
      </div>
      <div id="nav">
        <ul>
          <li >
            <a href="addAhomeForSale.php">Add a House for sale</a>
          </li>
          <li >
            <a href="updateAhome.php">Update House information</a>
          </li>
          <li >
            <a href="updateAhomePicture.php">Update House picture</a>
          </li>
          <li>
            <a href="searchhouse.php">Search House</a>
          </li>
          <li class="important">
            <a href="emailMenu.php">Mailbox</a>
          </li>
          <li>
            <a href="logout.php">Logout</a>
          </li>
        </ul>
      </div>
      <div id="news">
        <?php include("adgeneratorleft1.php");?>
        <div class="hr-dots"> </div>
        <?php include("adgeneratorleft2.php");?>
      </div>
      <div id="support">
      </div>
    </div>
    <div id="right">
      <h2>Home Transactions</h2>
      <div id="welcome">

      
  


   <?php 

$r =$_GET['id']

?>




   <?php
$u = $user->getUserID()


?>

   <?php //correct and get right string
$r =substr_replace ( $r , "" , 1 , strlen($r) );


?>

        <br></br>
 


<?php
$db_query = "UPDATE $TABLE_HOME SET  $TABLE_HOME_SOLDTO =  $u WHERE $TABLE_HOME_HOMEID=".$r;


    // Execute the query
    mysql_query($db_query);
    
    // Close the connection
    mysql_close();
  
   
?>
     <br>Thank you for using HSOBO and purchasing this house</br>
<br/><br/><br/>
<a href = "searchhouse.php">Go back to search page</a>
 
   









      </div>
      <h3></h3>
      <div id="profile">
        <div id="corp">
          <?php include("adgeneratorbottomleft.php");?>
        </div>
        <div id="indu">
          <?php include("adgeneratorbottomright.php");?>
        </div>
      </div>
	</div>
    <div class="clear"> </div>
    <div id="spacer"> </div>
    <div id="footer">
      <div id="copyright">
        &copy; Template taken from http://www.freewebsitetemplates.com/
      </div>
      <div id="footerline"></div>
    </div>

  </div>
</body>